﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace TinySkill
{

    /// <summary>
    /// 表示一个运行时技能
    /// </summary>
    public class Skill
    {
        public float cd;
        public int id;
        public int use_times;
        public config_skill data
        {
            get { return Data.GetSkill(id); }
        }
        public bool Init(int id)
        {
            this.id = id;
            if (data == null)
            {
                return false;
            }
            InitCD();
            return true;
        }

        public void Update(float deltaTime)
        {
            if (cd > 0)
            {
                cd -= deltaTime;
                cd = Math.Max(cd, 0);
            }
        }

        public void InitCD()
        {
            cd = data.pre_cd;
        }

    }

}